package ontology;

import ontology.actions.vo.VOGetCompleteInfo;
import ontology.actions.vo.VOGetKnowledge;
import ontology.actions.vo.VOGetUtilities;
import ontology.actions.vo.VOGetUtility;
import ontology.actions.vo.VOIndex;
import ontology.actions.vo.VOReturnKnowledge;
import ontology.concepts.vo.Antecedent;
import ontology.concepts.vo.Consequent;
import ontology.concepts.vo.VOObligation;
import ontology.concepts.vo.Situation;
import ontology.concepts.vo.VOAction;
import ontology.concepts.vo.VOCase;
import ontology.concepts.vo.VONorm;
import ontology.concepts.vo.VOOutcome;
import jade.content.onto.BasicOntology;
import jade.content.onto.BeanOntology;
import jade.content.onto.BeanOntologyException;
import jade.content.onto.Ontology;
import jade.content.onto.OntologyException;
import jade.content.schema.AgentActionSchema;
import jade.content.schema.ConceptSchema;
import jade.content.schema.ObjectSchema;
import jade.content.schema.PrimitiveSchema;

public class VOOntology extends BeanOntology{

	private static final long serialVersionUID = 1L;

	public static final String ONTOLOGY_NAME = "VO-Ontology";
	
	private static Ontology theInstance = new VOOntology();
	
	private VOOntology(){
		super(ONTOLOGY_NAME, BasicOntology.getInstance());
		
		try {
			add("ontology.concepts.vo");
			add("ontology.actions.vo");
			add("ontology.concepts.general");
			add("ontology.actions.general");
		} catch (BeanOntologyException e) {
			e.printStackTrace();
		}
	}
	
	public static Ontology getInstance(){
			return theInstance;
	}
	
	/*
	public static final String ONTOLOGY_NAME = "VO-Ontology";
	private static Ontology instance = new VOOntology();
	public static Ontology getInstance() { return instance; }
	
	private VOOntology()
	{
		super(ONTOLOGY_NAME, UMCourtLOntology.getInstance());
		
		try {
			//Concepts
			add(new ConceptSchema(VONORM), VONorm.class);
			add(new ConceptSchema(VOCASE), VOCase.class);
			add(new ConceptSchema(VOOUTCOME), VOOutcome.class);
			add(new ConceptSchema(VOACTION), VOAction.class);
			add(new ConceptSchema(SITUATION), Situation.class);
			add(new ConceptSchema(OBLIGATION), VOObligation.class);
			add(new ConceptSchema(ANTECEDENT), Antecedent.class);
			add(new ConceptSchema(CONSEQUENT), Consequent.class);
			
			add(new AgentActionSchema(VOGETCOMPLETEINFO), VOGetCompleteInfo.class);
			add(new AgentActionSchema(VOGETUTILITIES), VOGetUtilities.class);
			add(new AgentActionSchema(VOGETUTILITY), VOGetUtility.class);
			add(new AgentActionSchema(VOGETKNOWLEDGE), VOGetKnowledge.class);
			add(new AgentActionSchema(VORETURNKNOWLEDGE), VOReturnKnowledge.class);
			add(new AgentActionSchema(VOINDEX), VOIndex.class);
			
			//Actions
			
			
			//Concepts definition
			//VOAction
			ConceptSchema c = (ConceptSchema) getSchema(VOACTION);
			c.add(VOACTION_SENDER, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY);
			c.add(VOACTION_RECEIVER, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY);
			c.add(VOACTION_NAME, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY);
			c.add(VOACTION_WHEN, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY);
			c.add(VOACTION_ARGS, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.OPTIONAL);
			
			//SITUATION
			c = (ConceptSchema) getSchema(SITUATION);
			c.add(SITUATION_WHEN, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY);
			c.add(SITUATION_ID, (PrimitiveSchema) getSchema(BasicOntology.INTEGER), ObjectSchema.MANDATORY);
			c.add(SITUATION_CONTRACT_ID, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY);
			c.add(SITUATION_ACTION, (ConceptSchema) getSchema(VOOntology.VOACTION), ObjectSchema.MANDATORY);
			c.add(SITUATION_TYPE, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY);
			
			//OBLIGATION
			c = (ConceptSchema) getSchema(OBLIGATION);
			c.add(OBLIGATION_ID, (PrimitiveSchema) getSchema(BasicOntology.INTEGER), ObjectSchema.MANDATORY);
			c.add(OBLIGATION_DEADLINE, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY);
			c.add(OBLIGATION_LIVELINE, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY);
			c.add(OBLIGATION_CONTRACT_ID, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.OPTIONAL);
			c.add(OBLIGATION_NORM_NAME, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.OPTIONAL);
			c.add(OBLIGATION_VOACTION, (ConceptSchema) getSchema(VOOntology.VOACTION), ObjectSchema.MANDATORY);
			
			//Antecedent
			c = (ConceptSchema) getSchema(ANTECEDENT);
			c.add(ANTECEDENT_ID, (PrimitiveSchema) getSchema(BasicOntology.INTEGER), ObjectSchema.MANDATORY);
			c.add(ANTECEDENT_SITUATION, (ConceptSchema) getSchema(VOOntology.SITUATION), 0, ObjectSchema.UNLIMITED);
			
			//Consequent
			c = (ConceptSchema) getSchema(CONSEQUENT);
			c.add(CONSEQUENT_ID, (PrimitiveSchema) getSchema(BasicOntology.INTEGER), ObjectSchema.MANDATORY);
			c.add(CONSEQUENT_PRESCRIPTION, (ConceptSchema) getSchema(VOOntology.OBLIGATION), 0, ObjectSchema.UNLIMITED);
			
			//VONORM
			c = (ConceptSchema) getSchema(VONORM);
			c.addSuperSchema((ConceptSchema)getSchema(UMCourtLOntology.ABSTRACTNORM));
			c.add(VONORM_ID, (PrimitiveSchema)getSchema(BasicOntology.INTEGER), ObjectSchema.MANDATORY);
			c.add(VONORM_CONTRACT_TYPE, (PrimitiveSchema)getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY);
			c.add(VONORM_ANTECEDENT, (ConceptSchema)getSchema(ANTECEDENT), ObjectSchema.MANDATORY);
			c.add(VONORM_CONSEQUENT, (ConceptSchema)getSchema(CONSEQUENT), ObjectSchema.MANDATORY);
			
			//VOCase
			c = (ConceptSchema) getSchema(VOCASE);
			c.add(ABSTRACTCASE_ID, (PrimitiveSchema) getSchema(BasicOntology.INTEGER), ObjectSchema.MANDATORY);
			c.add(VOCASE_OBLIGATION, (ConceptSchema)getSchema(OBLIGATION), ObjectSchema.MANDATORY);
			c.add(VOCASE_NORM, (ConceptSchema)getSchema(VONORM), ObjectSchema.MANDATORY);
			c.add(VOCASE_PARTIES, (PrimitiveSchema)getSchema(BasicOntology.STRING), 0, ObjectSchema.UNLIMITED);
			
			//VOOUTCOME
			c = (ConceptSchema) getSchema(VOOUTCOME);
			c.add(VOOUTCOME_ID, (PrimitiveSchema) getSchema(BasicOntology.INTEGER), ObjectSchema.MANDATORY);
			c.add(VOOUTCOME_CASE, (ConceptSchema) getSchema(VOCASE), ObjectSchema.MANDATORY);
			c.add(VOOUTCOME_OBLIGATIONS, (ConceptSchema) getSchema(OBLIGATION), 1, ObjectSchema.UNLIMITED);
			
			
			//Actions
			
			AgentActionSchema as;
	        as = (AgentActionSchema) getSchema(VOINDEX);
	        as.add(VOOUTCOMES, (ConceptSchema) getSchema(VOOUTCOME), 1, ObjectSchema.UNLIMITED);
	        
	        as = (AgentActionSchema) getSchema(LOG);
	        as.add(LOG_MESSAGE, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY);
	        as.add(LOG_TIME, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY);
	        
	        as = (AgentActionSchema) getSchema(GETCASE);
	        as.add(GETCASE_ID, (PrimitiveSchema) getSchema(BasicOntology.INTEGER), ObjectSchema.MANDATORY);
	        
	        as = (AgentActionSchema) getSchema(INFORMCASE);
	        as.add(INFORMCASE_CASE, (ConceptSchema) getSchema(VOCASE), ObjectSchema.MANDATORY);
	        
	        as = (AgentActionSchema) getSchema(PRESELECT);
	        as.add(PRESELECT_NEW_CASE, (ConceptSchema) getSchema(VOCASE), ObjectSchema.MANDATORY);
	        as.add(PRESELECT_METHOD, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY);
	        
	        as = (AgentActionSchema) getSchema(GETCASES);
	        as.add(GETCASES_R, (ConceptSchema) getSchema(DBQUERYRULES), ObjectSchema.MANDATORY);
	        as.add(GETCASES_C, (ConceptSchema) getSchema(VOCASE), ObjectSchema.MANDATORY);
	        
	        as = (AgentActionSchema) getSchema(PARSECASES);
	        as.add(PARSECASES_CASEIDS, (PrimitiveSchema) getSchema(BasicOntology.INTEGER), 0, ObjectSchema.UNLIMITED);
	        
	        as = (AgentActionSchema) getSchema(RETURNLIST);
	        as.add(RETURNLIST_LIST, (ConceptSchema) getSchema(VOCASE), 0, ObjectSchema.UNLIMITED);
	        
	        as = (AgentActionSchema) getSchema(RETURNPARSECASES);
	        as.add(RETURNPARSECASES_LIST, (ConceptSchema) getSchema(VOCASE), 0, ObjectSchema.UNLIMITED);
	        
	        as = (AgentActionSchema) getSchema(ADDNEWRESULT);
	        as.add(ADDNEWRESULT_NEW_RESULT, (ConceptSchema) getSchema(RESULT), ObjectSchema.MANDATORY);
	        
	        as = (AgentActionSchema) getSchema(ADDNEWTIME);
	        as.add(ADDNEWTIME_TIME, (PrimitiveSchema) getSchema(BasicOntology.INTEGER), ObjectSchema.MANDATORY);
	        as.add(ADDNEWTIME_ID, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY);
	        
	        as = (AgentActionSchema) getSchema(GETSIMILARITIES);
	        as.add(GETSIMILARITIES_CASES, (ConceptSchema) getSchema(VOCASE), 1, ObjectSchema.UNLIMITED);
	        as.add(GETSIMILARITIES_NEW_C, (ConceptSchema) getSchema(VOCASE), ObjectSchema.MANDATORY);
	        as.add(GETSIMILARITIES_METHOD, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY);
	        
	        as = (AgentActionSchema) getSchema(GETSIMILARCASES);
	        as.add(GETSIMILARCASES_NEWCASE1, (ConceptSchema) getSchema(VOCASE), ObjectSchema.MANDATORY);
	        
	        as = (AgentActionSchema) getSchema(RETURNSIMILARITIES);
	        as.add(RETURNSIMILARITIES_CASE_LIST, (ConceptSchema) getSchema(VOCASE), 1, ObjectSchema.UNLIMITED);
	        as.add(RETURNSIMILARITIES_COMPARED_CASE, (ConceptSchema) getSchema(VOCASE), ObjectSchema.MANDATORY);
	        as.add(RETURNSIMILARITIES_SIMILARITIES, (PrimitiveSchema) getSchema(BasicOntology.FLOAT), 1, ObjectSchema.UNLIMITED);
	        

			as = (AgentActionSchema) getSchema(VOGETUTILITIES);
			as.add(VOGETUTILITIES_IDS, (PrimitiveSchema) getSchema(BasicOntology.INTEGER), 1, ObjectSchema.UNLIMITED);
			as.add(VOGETUTILITIES_OBLIGATION, (ConceptSchema) getSchema(OBLIGATION), ObjectSchema.MANDATORY);
			
			
			as = (AgentActionSchema) getSchema(RETURNUTILITIES);
			as.add(RETURNUTILITIES_IDS, (PrimitiveSchema) getSchema(BasicOntology.INTEGER), 1, ObjectSchema.UNLIMITED);
			as.add(RETURNUTILITIES_UTILITIES, (PrimitiveSchema) getSchema(BasicOntology.FLOAT),1, ObjectSchema.UNLIMITED);
			as.add(RETURNUTILITIES_OUTCOMES, (ConceptSchema) getSchema(VOOUTCOME), 1, ObjectSchema.UNLIMITED);
			
			as = (AgentActionSchema) getSchema(VOGETCOMPLETEINFO);
			as.add(VOGETCOMPLETEINFO_NEWCASE, (ConceptSchema) getSchema(VOCASE), ObjectSchema.MANDATORY);
			as.add(VOGETCOMPLETEINFO_OBLIGATION, (ConceptSchema) getSchema(OBLIGATION), ObjectSchema.MANDATORY);
			
			as = (AgentActionSchema) getSchema(RETURNCOMPLETEINFO);
			as.add(RETURNCOMPLETEINFO_IDS, (PrimitiveSchema) getSchema(BasicOntology.INTEGER), 1, ObjectSchema.UNLIMITED);
			as.add(RETURNCOMPLETEINFO_UTILITES, (PrimitiveSchema) getSchema(BasicOntology.FLOAT),1, ObjectSchema.UNLIMITED);
	        as.add(RETURNCOMPLETEINFO_SIMILARITIES, (PrimitiveSchema) getSchema(BasicOntology.FLOAT), 1, ObjectSchema.UNLIMITED);
	        as.add(RETURNCOMPLETEINFO_OUTCOMES, (ConceptSchema) getSchema(VOOUTCOME), 1, ObjectSchema.UNLIMITED);
	        

	        as = (AgentActionSchema) getSchema(GETKNOWLEDGE);
	        as.add(VOGETKNOWLEDGE_NEWCASE, (ConceptSchema) getSchema(VOOntology.VOCASE), ObjectSchema.MANDATORY);
	        
	        as = (AgentActionSchema) getSchema(VORETURNKNOWLEDGE);
	        as.add(RETURNKNOWLEDGE_BATNA, (PrimitiveSchema) getSchema(BasicOntology.FLOAT), ObjectSchema.MANDATORY);
	        as.add(RETURNKNOWLEDGE_WATNA, (PrimitiveSchema) getSchema(BasicOntology.FLOAT), ObjectSchema.MANDATORY);
			as.add(VORETURNKNOWLEDGE_RETURNCOMPLETEINFO, (ConceptSchema) getSchema(RETURNCOMPLETEINFO), ObjectSchema.MANDATORY);
			
			as = (AgentActionSchema) getSchema(VOGETUTILITY);
	        as.add(VOGETUTILITY_VOOUTCOME, (PrimitiveSchema) getSchema(BasicOntology.STRING), ObjectSchema.MANDATORY);
	        as.add(VOGETUTILITY_OBLIGATION, (ConceptSchema) getSchema(OBLIGATION), ObjectSchema.MANDATORY);
	        
			as = (AgentActionSchema) getSchema(RETURNUTILITY);
	        as.add(RETURNUTILITY_UTILITY, (PrimitiveSchema) getSchema(BasicOntology.FLOAT), ObjectSchema.MANDATORY);
	        
		} catch (OntologyException e) {
			e.printStackTrace();
		}
	}*/
	
}
